package com.ygqh.baby.service;

import com.ygqh.baby.ao.*;
import com.ygqh.baby.po.YgOrder;
import com.ygqh.baby.po.YgOrderPayment;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface YgOrderPaymentService {

	List<YgOrderPayment> find();

	int findCount();

	YgOrderPayment findById(Long id);

	int save(YgOrderPayment ygOrderPayment);

	int update(YgOrderPayment ygOrderPayment);

	int saveOrUpdate(YgOrderPayment ygOrderPayment);

	ResultSet<YgOrderPayment> search(QueryInfo queryInfo, String q);

	int addPaymentRecord(BusinessModule businessModule, String orderId, BigDecimal totalPrice, String paymentCode,
						 PayType payType, AppType appType,
			String prepayId, String platformNo, String paltformName);

	int addPaymentRecord(String orderId, BigDecimal totalPrice, String paymentCode, PayType payType, AppType appType);

	YgOrderPayment findByPayCode(String paymentCode);

	/**
	 * 订单支付成功，更新流水
	 * @param payment
	 * @return
	 */
	int writeBackPayment(YgOrderPayment payment);

	YgOrderPayment findByOrderId(String orderId);
	YgOrderPayment findByOrderId(Long orderId);
	YgOrderPayment findByOrderId(String orderId,BusinessModule businessModule);

	YgOrder findOrderByPaymentCode(String paymentCode, Boolean paid);

	int updatePaySuccess(String paymentCode, String tradeNo, AppType appType, PayType payType, BigDecimal paidPrice, Date paidTime);

	YgOrder findOrderByPaymentCode(String paymentCode, Boolean paid, BusinessModule businessModule);

}
